home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / String Mak244058102001.psc / String Maker / frmInput.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-08-07  |  3.4 KB  |  115 lines

  1. VERSION 5.00
  2. Begin VB.Form frmInput 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "String Input"
  5.    ClientHeight    =   3585
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6765
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3585
  14.    ScaleWidth      =   6765
  15.    Begin VB.CommandButton Command3 
  16.       Caption         =   "Copy Formated Output"
  17.       Height          =   375
  18.       Left            =   240
  19.       TabIndex        =   4
  20.       Top             =   3120
  21.       Visible         =   0   'False
  22.       Width           =   1935
  23.    End
  24.    Begin VB.CommandButton Command2 
  25.       Caption         =   "Clear"
  26.       Height          =   375
  27.       Left            =   5160
  28.       TabIndex        =   3
  29.       Top             =   3120
  30.       Width           =   1215
  31.    End
  32.    Begin VB.CommandButton Command1 
  33.       Caption         =   "Paste From Clipboard"
  34.       Height          =   375
  35.       Left            =   3120
  36.       TabIndex        =   2
  37.       Top             =   3120
  38.       Width           =   1815
  39.    End
  40.    Begin VB.TextBox txtInput 
  41.       Height          =   2535
  42.       Left            =   240
  43.       MultiLine       =   -1  'True
  44.       ScrollBars      =   3  'Both
  45.       TabIndex        =   1
  46.       Top             =   360
  47.       Width           =   6255
  48.    End
  49.    Begin VB.Frame Frame1 
  50.       Caption         =   "Type the text to be formated here"
  51.       Height          =   2895
  52.       Left            =   120
  53.       TabIndex        =   0
  54.       Top             =   120
  55.       Width           =   6495
  56.    End
  57. Attribute VB_Name = "frmInput"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = False
  60. Attribute VB_PredeclaredId = True
  61. Attribute VB_Exposed = False
  62. Private Sub Command1_Click()
  63. txtInput.Text = Clipboard.GetText
  64. End Sub
  65. Private Sub Command2_Click()
  66. InputIsDirty = False
  67. txtInput.Text = ""
  68. End Sub
  69. Private Sub txtInput_Change()
  70. Dim Comillas As String
  71. Dim CR1 As String
  72. Dim CR2 As String
  73. Dim NewLineVar As String
  74. Dim NewLineSym As String
  75. Dim WorkString As String
  76. Comillas = Chr(34) & " & chr(34) & " & Chr(34)
  77. CR1 = Chr(34) & " & vbNewLine " & vbNewLine
  78. CR2 = Chr(34) & " & vbNewLine _" & vbNewLine
  79. NewLineVar = RecipientVar & " = " & RecipientVar & " & " & Chr(34)
  80. NewLineSym = "& " & Chr(34)
  81. WorkString = ""
  82. If txtInput.Text = "" Then Exit Sub
  83. 'Start string formating
  84. '1.- setting the initial string
  85. If RecipientVar = "" Then RecipientVar = "Var"
  86. WorkString = RecipientVar & " = " & Chr(34)
  87. '2.- Check the string for newlines
  88. For x = 1 To Len(txtInput.Text)
  89. 'Debug.Print Mid(txtInput.Text, x, 1), Asc(Mid(txtInput.Text, x, 1))
  90. Select Case Mid(txtInput.Text, x, 1)
  91.     Case Chr(34)
  92.         WorkString = WorkString & Comillas
  93.         
  94.     Case Chr(13)
  95.         If BrakeSymbol = False Then
  96.         WorkString = WorkString & CR1 & NewLineVar
  97.         Else
  98.         WorkString = WorkString & CR2 & NewLineSym
  99.         End If
  100.     Case Chr(10)
  101.         ' do nothin
  102.         ' Just to get rid of line feed
  103.         
  104.         
  105.     Case Else
  106.         WorkString = WorkString & Mid(txtInput.Text, x, 1)
  107.         
  108. End Select
  109. Next x
  110. '3.- Close the string
  111. WorkString = WorkString & Chr(34)
  112. '4- Update output window
  113. frmOutput.txtOutput.Text = WorkString
  114. End Sub
  115.